/**
 * 导入历史API
 */
import request from '@/api/request'

/**
 * 导入历史记录
 */
export interface ImportHistoryItem {
  filename: string
  type: string
  total: number
  success: number
  failed: number
  import_time: string
  status: string
  batch_id: string
}

/**
 * API响应格式
 */
interface ApiResponse<T> {
  code: number
  message: string
  data: T
}

/**
 * 导入历史API
 */
export const importHistoryApi = {
  /**
   * 获取导入历史列表
   */
  async getHistory(skip: number = 0, limit: number = 50): Promise<ImportHistoryItem[]> {
    const response = await request.get<ApiResponse<ImportHistoryItem[]>>(`v1/imports/history?skip=${skip}&limit=${limit}`)
    return response.data.data
  },
}
